#include <iostream>

using namespace std;

typedef long long LL;

const int N = 2e5 + 10;

int a[N];
LL f[N];

int n;
int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		f[i] = f[i - 1] + a[i];
	}
	LL ans = 0;
	for(int i = 1; i <= n; i++)
	{
		// a1 a2 + a3 + a4 +...+ an
		ans = ans + (a[i] * (f[n] - f[i]));
	}
	cout << ans << endl;
	return 0;
}
